/*
 * @Description: 元数据列表
 * @Author: Rfan
 * @Date: 2022-01-20 15:45:14
 * @LastEditTime: 2022-01-20 16:20:19
 */

import React from 'react';
import { Table, Tag } from 'antd';
import { useMetadataContext } from '../contexts/MetadataConfigContext';

const { Column } = Table;

const MetadataList = () => {
  const { metadataList, metadataLoading } = useMetadataContext();
  return (
    <>
      <Table dataSource={metadataList} loading={metadataLoading}>
        <Column title="ID" dataIndex="id" key="id" align="center" />
        <Column title="中文名" dataIndex="c_name" key="c_name" align="center" />
        <Column title="英文名" dataIndex="e_name" key="e_name" align="center" />
        <Column
          title="允许重复"
          dataIndex="allowed_dup"
          key="allowed_dup"
          align="center"
          render={(allowed_dup) => (
            <Tag color="blue">
              {/* {duplicateFilter(allowed_dup)} */}
              allowed_dup
            </Tag>
          )}
        />
        <Column
          title="允许空"
          dataIndex="allowed_null"
          key="allowed_null"
          align="center"
          render={(allowed_null) => (
            <Tag color="blue">
              {/* {nullFilter(allowed_null)} */}
              allowed_null
            </Tag>
          )}
        />
        <Column title="默认值" dataIndex="default_value" key="default_value" align="center" />
        <Column title="删除状态" dataIndex="deleted" key="deleted" align="center" />
        {/* <Column title="字段类型" dataIndex="field_type" key="field_type" align="center"
          render={id => fieldTypeFilter(id)}
        />
        <Column title="字段种类" dataIndex="field_kind" key="field_kind"align="center"
          render={id => fieldKindFilter(id)}
        /> */}
        <Column title="字段类型" dataIndex="field_type" key="field_type" align="center" />
        <Column title="字段种类" dataIndex="field_kind" key="field_kind" align="center" />
        <Column title="长度" dataIndex="length" key="length" align="center" />
      </Table>
    </>
  );
};

export default MetadataList;
